

# TODO:    elif category.subs .count()==0 为什么不能写成  is None

def get_breadcrumb(category):
    breadcrumb={
        'cat1':'',
        'cat2':'',
        'cat3':'',
    }
    if category.parent is None:
        breadcrumb['cat1']=category
    elif category.subs.count() == 0:
        breadcrumb['cat1']=category.parent.parent
        breadcrumb['cat2']=category.parent
        breadcrumb['cat3']=category
    else:
        breadcrumb['cat1']=category.parent
        breadcrumb['cat2']=category

    return breadcrumb